import { Controller, Get, Post, Body, Param, Delete, Put, Query } from '@nestjs/common';
import { Imgd_Service } from './imgd.service';
import { Imgd_Create_Dto, Imgd_Update_Dto } from './assets/imgd.dto';
import { Imgd_Find_Dto } from './assets/imgd.dto';
import { ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';

@Controller('/adm/imgd')
@ApiTags('imgd 图片管理')
export class Imgd_Controller {
  constructor(private readonly imgd_Service: Imgd_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
    //apiKey: '/adm/imgd/add Post',
  })
  async imgd_Create(@Body() body: Imgd_Create_Dto) {
    return util_Index_ReturnContent(await this.imgd_Service.imgd_Create(body));
  }

  @Get('/list')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
    //apiKey: '/adm/imgd/list Get',
  })
  async imgd_FindByPage(@Query() query: Imgd_Find_Dto) {
    return util_Index_ReturnContent(await this.imgd_Service.imgd_FindByPage(query));
  }

  @Put('/update')
  @util_ApiResponse_Base({
    dataType: 'dataType_update',
    //apiKey: '/adm/imgd/update Put',
  })
  async imgd_Update(@Body() body: Imgd_Update_Dto) {
    return util_Index_ReturnContent(await this.imgd_Service.imgd_Update(body));
  }

  @Delete('/delete/:id')
  @util_ApiResponse_Base({
    dataType: 'dataType_delete',
    //apiKey: '/adm/imgd/delete/:id Delete',
  })
  async imgd_Remove(@Param('id') id: string) {
    return util_Index_ReturnContent(await this.imgd_Service.imgd_Remove(+id));
  }
}
